/*
 * R2DIntArray.cpp
 * according to http://wiki.forum.nokia.com/index.php/Two_Dimensional_TInt_Array_in_Symbian
 *  Created on: 15.11.2008
 *      Author: lenli
 */

#include "R2DIntArray.h"

// destructor
R2DIntArray::~R2DIntArray()
	{
	ResetAndDestroy();
	};
     
void R2DIntArray::ResetAndDestroy()
	{
	for (TInt i=0; i<Count(); i++) 
 
	{
 
		(*this)[i]->Reset();
 
	}
	RPointerArray<RIntegerArray>::ResetAndDestroy();
	};
 
 
 
// Finding the particular  integer value
 
TInt R2DIntArray::Find(TInt aInteger)
	{
	for (TInt i=0; i<Count(); i++)
		if (aInteger == (*((*this)[i]))[0])
			return i;
	return KErrNotFound;
	}
 
 
// adding the entry
void R2DIntArray::Add(TInt aInteger)
	{
	Append(new RIntegerArray);
	(*this)[Count() - 1]->Append(aInteger);
	}
 
// Appending the entry
 
void R2DIntArray::AppendLast(TInt aPosition, TInt aValue)
	{
	(*this)[aPosition]->Append(aValue);
	}

void R2DIntArray::Set(TInt aRow, TInt aColumn, TInt aValue)
	{
	(*(*this)[aRow])[aColumn] = aValue;
	}
